package com.erp.erp_servers.business.imp;

import com.erp.erp_dao.business.IOfferDetailDao;
import com.erp.erp_entitys.business.entity.OfferDetailEntity;
import com.erp.erp_entitys.business.req.OfferProductStatisticsInfoReq;
import com.erp.erp_entitys.business.rsp.OfferProductStatisticsRsp;
import com.erp.erp_servers.business.IOfferDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName : OfferDetailServiceImp
 * @Description : 报价明细实现类
 * @Author : lst
 * @Date: 2021-01-14 10:37
 */
@Service
public class OfferDetailServiceImp implements IOfferDetailService {

    /**
     * 注入报价明细mapper
     */
    private final IOfferDetailDao offerDetailDao;

    @Autowired
    public OfferDetailServiceImp(IOfferDetailDao offerDetailDao) {
        this.offerDetailDao = offerDetailDao;
    }


    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public OfferDetailEntity queryById(Integer id) {
        return offerDetailDao.queryById(id);
    }


    /**
     * 通过实体作为筛选条件查询
     *
     * @param offerDetail 实例对象
     * @return 对象列表
     */
    @Override
    public List<OfferDetailEntity> queryAll(OfferDetailEntity offerDetail) {
        return offerDetailDao.queryAll(offerDetail);
    }


    /**
     * 新增数据
     *
     * @param offerDetail 实例对象
     * @return 影响行数
     */
    @Override
    public int insert(OfferDetailEntity offerDetail) {
        return offerDetailDao.insert(offerDetail);
    }


    /**
     * 详情批量新增
     * @param list 新增对象集合
     * @return 影响行数
     */
    @Override
    public int addList(List<OfferDetailEntity> list) {
        return offerDetailDao.addList(list);
    }


    /**
     * 修改数据
     *
     * @param offerDetail 实例对象
     * @return 影响行数
     */
    @Override
    public int update(OfferDetailEntity offerDetail) {
        return offerDetailDao.update(offerDetail);
    }


    /**
     * 统计
     * @param req 查询条件实体
     * @return 统计信息
     */
    @Override
    public List<OfferProductStatisticsRsp> getOfferProductStatistics(OfferProductStatisticsInfoReq req) {
        return offerDetailDao.getOfferProductStatistics(req);
    }
}
